import yagmail,logging

class Tools():
    def log(self):
        log = logging.basicConfig(level=logging.INFO,
                                  filename='baidufirstpagewebtestlog.txt',
                                  filemode='a+',
                                  format='%(message)s %(filename)s %(name)s %(asctime)s %(thread)d ')
        return log
    def email(self):
        # 账号：zzh2834326498@qq.com
        # 授权码：rbtbgahnvdwaddbf
        e=yagmail.SMTP(user='zzh2834326498@qq.com',password='rbtbgahnvdwaddbf',host='smtp.qq.com',port=465)
        e.send(to='zzh2834326498@qq.com',
                    subject='百度WebFirstPage Ui自动化测试报告',
                    contents='请查收',
                    attachments=[r'C:\Users\张震海\Desktop\month_8_12\month\Run\html\index.html',r'C:\Users\张震海\Desktop\month_8_12\month\Run\baidufirstpagewebtestlog.txt'])